str1 = input()
str2 = str1.lower()
list1 = [0] * 26
for i in range (0,len(str1)):
    if str2[i] == 'a':
        list1[0] += 1
    if str2[i] == 'b':
        list1[1] += 1
    if str2[i] == 'c':
        list1[2] += 1
    if str2[i] == 'd':
        list1[3] += 1
    if str2[i] == 'e':
        list1[4] += 1
    if str2[i] == 'f':
        list1[5] += 1
    if str2[i] == 'g':
        list1[6] += 1
    if str2[i] == 'h':
        list1[7] += 1
    if str2[i] == 'i':
        list1[8] += 1
    if str2[i] == 'j':
        list1[9] += 1
    if str2[i] == 'k':
        list1[10] += 1
    if str2[i] == 'l':
        list1[11] += 1
    if str2[i] == 'm':
        list1[12] += 1
    if str2[i] == 'n':
        list1[13] += 1
    if str2[i] == 'o':
        list1[14] += 1
    if str2[i] == 'p':
        list1[15] += 1
    if str2[i] == 'q':
        list1[16] += 1
    if str2[i] == 'r':
        list1[17] += 1
    if str2[i] == 's':
        list1[18] += 1
    if str2[i] == 't':
        list1[19] += 1
    if str2[i] == 'u':
        list1[20] += 1
    if str2[i] == 'v':
        list1[21] += 1 
    if str2[i] == 'w':
        list1[22] += 1
    if str2[i] == 'x':
        list1[23] += 1
    if str2[i] == 'y':
        list1[24] += 1
    if str2[i] == 'z':
        list1[25] += 1
print(max(list1))
for i in range(0,25):
    if list1[i] == max(list1):
        print(chr(i+97))